/**
  * @brief conversion 操作
  */

#include <iostream>
using namespace std;

class Y
{
	public:
		Y()
		{
			a = 10;
		}
		~Y()
		{

		}
		bool operator==(const Y& other) const
		{
			return this->a == other.a;
		}
	private:
		int a;
};

class X
{
	public:
		X()
		{
		}
		~X()
		{
		}
		//类型转换
		operator Y() const		//类型转换运算符
		{
			return this->a;
		}
		X getValue()
		{
			return *this;
		}
	private:
		Y a;
};

int main()
{
	X xx;
	Y yy;
	if( yy == (Y)xx.getValue())
	{
		cout<<"相等"<<endl;
	}
	return 0;
}
